#pragma once
#include<iostream>
#include <pthread.h>
#include <string>

typedef void*(*func_t)(void*);
class ThreadData
{
public:
    std::string _name;
    void* _args;
};
class Thread
{
public:
    Thread(int num,func_t callback,void* args)
    {
        char namebuffer[1024];
        snprintf(namebuffer,sizeof(namebuffer),"Thread-%d",num);
        _name=namebuffer;
        _tdata._args=args;
        _tdata._name=_name;
    }
    void start(){
        pthread_create(&_tid, nullptr, _func, (void*)&_tdata);
    }
    void join(){
        pthread_join(_tid, nullptr);
    }
    std::string Name(){
        return _name;
    }
    ~Thread(){
        
    }
private:
    std::string _name;
    func_t _func;
    pthread_t _tid;
    ThreadData _tdata;
};